// detail.js

var that;
let App = getApp();
Page({
	data: {
		order:"",
		money:'',
		total_num:''
	},
	onLoad: function (options) {
		that = this;
		wx.request({
			url: App.url.requestUrl + 'order/orderInfo',
			method: 'POST',
			 header: {'content-type': 'application/x-www-form-urlencoded',"token":wx.getStorageSync('access_token')},
			dataType:'json',
			data:{
				order_id :options.id
			},
			success: function (res) {
				console.log(res)
			  if(res.data.ret == 200){
				 var total_num=0
				let money = Number(res.data.data.coupon_code_release_price)  + Number(res.data.data.coupon_release_price)
				for (let i = 0; i < res.data.data.order_goods.length; i++) {
					total_num+=res.data.data.order_goods[i].total_num
				}
				console.log(total_num)
				console.log(money)
					  that.setData({
					    order:res.data.data,
						money:money,
						total_num:total_num
					  })  
				 }
			}
		})
	},
	
})